home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / programer2 / icon / Source / Icont / C / Lnklist < prev    next >
Encoding:
Text File  |  1990-07-20  |  1.4 KB  |  72 lines

  1. /*
  2.  * lnklist.c -- functions for handling file linking.
  3.  */
  4.  
  5. #include "../h/config.h"
  6. #include "general.h"
  7. #include "tproto.h"
  8. #include "trans.h"
  9. #include "lfile.h"
  10.  
  11. /*
  12.  * Prototype.
  13.  */
  14. hidden    struct lfile *alclfile    Params((char *name));
  15.  
  16. struct lfile *lfiles;
  17.  
  18. /*
  19.  * Dummy function to satify restriction on the length of the name of
  20.  *  the first function in a file ... on a certain system.  Needs to
  21.  *  be handled in a better fashion.
  22.  */
  23.  
  24. /*
  25.  * One of the developers of ... a certain system ... urges everyone to
  26.  *  lighten up, and not take warning messages so seriously (and to
  27.  *  look into the SName compilation option).
  28.  */
  29.  
  30. novalue dummyda()
  31.    {
  32.    }
  33.  
  34. /*
  35.  * alclfile allocates an lfile structure for the named file, fills
  36.  *  in the name and returns a pointer to it.
  37.  */
  38. static struct lfile *alclfile(name)
  39. char *name;
  40.    {
  41.    struct lfile *p;
  42.    
  43.    p = (struct lfile *) alloc(sizeof(struct lfile));
  44.    if (!p)
  45.       tsyserr("not enough memory for file list");
  46.    p->lf_link = NULL;
  47.    p->lf_name = salloc(name);
  48.    return p;
  49.    }
  50.  
  51. /*
  52.  * addlfile creates an lfile structure for the named file and add it to the
  53.  *  end of the list of files (lfiles) to generate link instructions for.
  54.  */
  55. novalue addlfile(name)
  56. char *name;
  57. {
  58.    struct lfile *nlf, *p;
  59.    
  60.    nlf = alclfile(name);
  61.    if (lfiles == NULL) {
  62.       lfiles = nlf;
  63.       }
  64.    else {
  65.       p = lfiles;
  66.       while (p->lf_link != NULL) {
  67.          p = p->lf_link;
  68.          }
  69.       p->lf_link = nlf;
  70.       }
  71. }
  72.